package com.erps.sys.rest;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import com.erps.CommonUtils.StringEx;
import com.erps.db.DBManager;
import com.hmkj.entity.ErspPlatArgs;

public class ErspPlatArgsRest {
	public List<ErspPlatArgs> Query(String cArg_Code) {
		List<ErspPlatArgs> arKeys = new ArrayList<ErspPlatArgs>();
		List<Map<String, String>> dtRows = DBManager.QueryData("select id,arg_name,arg_value from ersp_plat_args where arg_code='" + cArg_Code + "'");
		int iLength = (dtRows == null) ? 0 : dtRows.size();
		for (int i = 0; i < iLength; i++) {
			Map<String, String> vo = dtRows.get(i);
			ErspPlatArgs vs = new ErspPlatArgs();
			vs.setId(StringEx.getMapVal(vo, "id"));
			vs.setArg_name(StringEx.getMapVal(vo, "arg_name"));
			vs.setArg_value(StringEx.getMapVal(vo, "arg_value"));

			arKeys.add(vs);
		}
		return arKeys;

	}

	public ErspPlatArgs FindOne(String cArg_Code) {
		ErspPlatArgs rs = new ErspPlatArgs();
		List<Map<String, String>> dtRows = DBManager.QueryData("select id,arg_name,arg_value from ersp_plat_args where arg_code='" + cArg_Code + "'");
		int iLength = (dtRows == null) ? 0 : dtRows.size();
		if (iLength > 0) {
			Map<String, String> vo = dtRows.get(0);
			rs.setId(StringEx.getMapVal(vo, "id"));
			rs.setArg_name(StringEx.getMapVal(vo, "arg_name"));
			rs.setArg_value(StringEx.getMapVal(vo, "arg_value"));
		}
		return rs;
	}
}